import {$Login} from '@bana/miniapp-common-util'

App({
  onLaunch(options) {
    const that = this
    // Do something initial when launch.
    console.log('onLaunch', options)
    // 判断是否登录，否则进行系统登录
    if (!$Login.getFromLocal()) {
      // 没有本地登录内容，执行登录
      wx.login({
        success(res) {
          if (res.code) {
            // 发起网络请求
            $Login.miniLogin(res.code, that.appId)
          } else {
            console.log('登录失败！' + res.errMsg)
          }
        }
      })
    }
  },
  onShow(options) {
    // Do something when show.
    console.log('onShow', options)
  },
  onHide() {
    // Do something when hide.
  },
  onError(msg) {
    console.log(msg)
  },
  globalData: 'I am global data',
  appId: 'wx916ac39e597a3cf3'

})
